package com.usmarter.server.db;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.usmarter.model.AnswerEntity;
import com.usmarter.model.QuestionEntity;
import com.usmarter.model.UserAccountEntity;


@Service
public class MyDB {


	@Autowired
	private QuestionCRUD questionsDB;
	@Autowired
	private AnswerCRUD answersDB;
	@Autowired
	private UserAccountCRUD userAccountsDB;
	
	public long createQuestion(QuestionEntity question)
	{
		return questionsDB.create(question);
	}
	

	public long createAnswer(AnswerEntity answer)
	{
		return answersDB.create(answer);
	}

	public long createUserAccount(UserAccountEntity userAccount)
	{
		return userAccountsDB.create(userAccount);
	}


	public QuestionEntity getQuestion(long id) {
		return questionsDB.get(id);
	}
	
	public AnswerEntity getAnswer(long id) {
		return answersDB.get(id);
	}
	
	public UserAccountEntity getUserAccount(long id) {
		return userAccountsDB.get(id);
	}
}
